<?php
include_once("$config[webroot]/module/product/includes/plugin_order_class.php");
$order=new order();

$filePath = '../uploadfile/download/sps/files';

if($_GET['order_id']){
    $oid = $_GET['order_id'];
    $orderInfo = $order->shop_orderdetail($oid);
    
    /*******数据处理********/
    $orderInfo['order_time_str'] = date('d/m/Y',$orderInfo['order_time']).'&nbsp;&nbsp;-&nbsp;&nbsp;'.date('H:i',$orderInfo['order_time']);
    $orderInfo['random_str'] = buildRandomStr();
    $total_num = 0;
    $total_cost = 0;
    foreach ($orderInfo['product'] as $key=>$val)
    {
        $sql = "select declared_price from ".SETMEAL." where id=".$val['product_id'];
        $db->query($sql);
        $price = $db->fetchField('declared_price');
        $price = round($price/7,2);
        $orderInfo['product'][$key]['price_u'] = $price;
        $orderInfo['product'][$key]['pname_fra'] = translateWords($val['product_name']);
        $orderInfo['product'][$key]['price_all'] = $price*$val['num'];
        $total_num += $val['num'];
        $total_cost += $orderInfo['product'][$key]['price_all'];
    }
    $orderInfo['total_num'] = $total_num;
    $orderInfo['cost_eur'] = $total_cost;
    $orderInfo['cost_temp'] = round(0.2*$total_cost,2);
    
    $tpl->assign('orderInfo',$orderInfo);
    $tpl->display('sps_bill_smarty.htm');
}else{
    echo '非法访问';
}
?>